package com.tj.template.application.user.output;

import com.fqgj.common.utils.StringUtils;
import com.tj.bo.user.client.vo.output.UserQueryOutput;

import java.io.Serializable;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: binary
 * Date: 2020/6/9
 * Time: 下午6:13
 */
public class UserMyActionApOutput implements Serializable {
    private String email;
    private String userIDCode;
    private String userCode;
    private String balance;
    private List<ActionItem> actions;
    private InviteFriendMenuVO inviteFriendMenu;

    public UserMyActionApOutput() {
    }

    public UserMyActionApOutput(UserQueryOutput userQueryVo, String balance, List<ActionItem> actions) {
        if (StringUtils.isNotEmpty(userQueryVo.getUserBaseReal().getEmail())) {
            this.email = userQueryVo.getUserBaseReal().getEmail();
        } else if (StringUtils.isNotEmpty(userQueryVo.getUserBaseReal().getUserName())) {
            this.email = userQueryVo.getUserBaseReal().getNickname();
        } else {
            this.email = userQueryVo.getUserBaseReal().getLoginNumber().substring(userQueryVo.getUserBaseReal().getLoginNumber().length() - 7);
        }

        this.userCode = userQueryVo.getUserBaseReal().getUserCode();
        this.userIDCode = userQueryVo.getUserBaseReal().getUserIDCode();

        this.actions = actions;
        this.balance = balance;
    }

    public String getBalance() {
        return balance;
    }

    public UserMyActionApOutput setBalance(String balance) {
        this.balance = balance;
        return this;
    }

    public String getEmail() {
        return email;
    }

    public UserMyActionApOutput setEmail(String email) {
        this.email = email;
        return this;
    }

    public String getUserIDCode() {
        return userIDCode;
    }

    public UserMyActionApOutput setUserIDCode(String userIDCode) {
        this.userIDCode = userIDCode;
        return this;
    }

    public String getUserCode() {
        return userCode;
    }

    public UserMyActionApOutput setUserCode(String userCode) {
        this.userCode = userCode;
        return this;
    }

    public List<ActionItem> getActions() {
        return actions;
    }

    public UserMyActionApOutput setActions(List<ActionItem> actions) {
        this.actions = actions;
        return this;
    }

    public static class ActionItem {
        private String title;
        private String imgUrl;
        private String jumpUrl;
        private boolean needLogin;

        public boolean isNeedLogin() {
            return needLogin;
        }

        public ActionItem setNeedLogin(boolean needLogin) {
            this.needLogin = needLogin;
            return this;
        }

        public ActionItem() {
        }

        public ActionItem(String title, String imgUrl, String jumpUrl, boolean needLogin) {
            this.title = title;
            this.imgUrl = imgUrl;
            this.jumpUrl = jumpUrl;
            this.needLogin = needLogin;
        }

        public String getTitle() {
            return title;
        }

        public ActionItem setTitle(String title) {
            this.title = title;
            return this;
        }

        public String getImgUrl() {
            return imgUrl;
        }

        public ActionItem setImgUrl(String imgUrl) {
            this.imgUrl = imgUrl;
            return this;
        }

        public String getJumpUrl() {
            return jumpUrl;
        }

        public ActionItem setJumpUrl(String jumpUrl) {
            this.jumpUrl = jumpUrl;
            return this;
        }
    }

    public InviteFriendMenuVO getInviteFriendMenu() {
        return inviteFriendMenu;
    }

    public UserMyActionApOutput setInviteFriendMenu(InviteFriendMenuVO inviteFriendMenu) {
        this.inviteFriendMenu = inviteFriendMenu;
        return this;
    }

    public static class InviteFriendMenuVO{

        private String imgUrl;
        private String jumpUrl;
        private boolean needLogin;

        public InviteFriendMenuVO(String imgUrl, String jumpUrl, boolean needLogin) {
            this.imgUrl = imgUrl;
            this.jumpUrl = jumpUrl;
            this.needLogin = needLogin;
        }

        public boolean isNeedLogin() {
            return needLogin;
        }

        public InviteFriendMenuVO setNeedLogin(boolean needLogin) {
            this.needLogin = needLogin;
            return this;
        }

        public String getImgUrl() {
            return imgUrl;
        }

        public InviteFriendMenuVO setImgUrl(String imgUrl) {
            this.imgUrl = imgUrl;
            return this;
        }

        public String getJumpUrl() {
            return jumpUrl;
        }

        public InviteFriendMenuVO setJumpUrl(String jumpUrl) {
            this.jumpUrl = jumpUrl;
            return this;
        }
    }

}
